<?php

use RHX\Helper\Number;
use RHX\Helper\RHDateTime;

$list = $this->stories;
$count	 = count($list) - 1;
//var_dump($list);
?>
<div class='content-body'>
    <div class='empl-border'>
	<?php foreach ($list as $l): ?>
            <span class='bolder'><?php echo $l['employe']->prenom . ' ' . $l['employe']->nom1; ?></span>
	    <?php break; ?>
	<?php endforeach; ?>
    </div>
    <?php foreach($list as $history): ?>
    <?php
    $employe = $history['employe'];
    $avenant = $history['avenant'];
    $poste = $history['poste'];
    ?>
    
            <div class='empl-border'>
            <h3>
		<?php
		echo ($count != 0) ? 'Avenant n°' . $count : 'Contrat Initiale';
		$count--;
		?>
    	</h3>
        <div class="empl-left" style="width: 50%">
            <div class="empl-group">
                <div class="empl-full saumon">
                    Poste : <span class='bolder'><?php echo $poste->libelle ?></span>
                </div>
                <div class="empl-full saumon">
                    Collège : <span class='bolder'></span>
                </div>
                <div class="empl-full saumon">
                            Niveau : <span class='bolder'><?php echo Number::getRomanNumber($poste->niveau) ?></span>
                </div>
                <div class="empl-full saumon">
                    Echelon : <span class='bolder'><?php echo $poste->echelon ?></span>
                </div>
            </div>
        </div>

        <div class="empl-right" style="width: 49%">
            <div class="empl-group">
                <div class="empl-full jaune">
                            Contrat horaire hebdomadaire : <span class='bolder'><?php echo number_format($avenant->hebdo, 2, ',', ' '); ?></span> H
                </div>
                <div class="empl-full jaune">
                            Taux horaire : <span class='bolder'><?php echo number_format($avenant->taux, 2, ',', ' '); ?></span> €
                </div>
                        <div class="empl-full gris">
			<?php $debut	 = new RHDateTime($avenant->debut); ?>
                        Début : <span class='bolder'><?php echo $debut->dateFr(); ?></span>
                </div>
                        <div class="empl-full gris">
			<?php $fin	 = new RHDateTime($avenant->fin); ?>
                        Fin : <span class='bolder'><?php echo ($avenant->fin == '0000-00-00') ? 'Indéterminé' : $fin->dateFr(); ?></span>
                </div>
            </div>
        </div>
    </div>
    <?php endforeach; ?>
</div>
<style type='text/css'>
    .bolder{
        font-weight: bolder;
        color: #0000cc;
    }
</style>